<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="-weblogic -oracle,">










<meta name="description" content="&amp;emsp;&amp;emsp;由于之前所接触的项目中，使用weblogic实在windowsserver上面操作，安装界面部署界面都是以图形化为主，最近的项目使用的weblogic则是在linux环境下的，所有重新了解下weblogic在linux下的使用。此处以weblogic12为例  安装 &amp;emsp;&amp;emsp;其实在linux下面也是可以使用图形化安装界面的，但是,是不是觉得在Linux下面">
<meta name="keywords" content="-weblogic -oracle">
<meta property="og:type" content="article">
<meta property="og:title" content="重新认识weblogic">
<meta property="og:url" content="https://zhangzt123.github.io/2020/07/13/2020-07-13-重新认识weblogic/index.html">
<meta property="og:site_name">
<meta property="og:description" content="&amp;emsp;&amp;emsp;由于之前所接触的项目中，使用weblogic实在windowsserver上面操作，安装界面部署界面都是以图形化为主，最近的项目使用的weblogic则是在linux环境下的，所有重新了解下weblogic在linux下的使用。此处以weblogic12为例  安装 &amp;emsp;&amp;emsp;其实在linux下面也是可以使用图形化安装界面的，但是,是不是觉得在Linux下面">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2020-07-24T08:59:07.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="重新认识weblogic">
<meta name="twitter:description" content="&amp;emsp;&amp;emsp;由于之前所接触的项目中，使用weblogic实在windowsserver上面操作，安装界面部署界面都是以图形化为主，最近的项目使用的weblogic则是在linux环境下的，所有重新了解下weblogic在linux下的使用。此处以weblogic12为例  安装 &amp;emsp;&amp;emsp;其实在linux下面也是可以使用图形化安装界面的，但是,是不是觉得在Linux下面">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://zhangzt123.github.io/2020/07/13/2020-07-13-重新认识weblogic/">





  <title>重新认识weblogic | </title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title"></span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhangzt123.github.io/2020/07/13/2020-07-13-重新认识weblogic/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="MR.zhang">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content>
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">重新认识weblogic</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-07-13T14:59:34+08:00">
                2020-07-13
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2020-07-24T16:59:07+08:00">
                2020-07-24
              </time>
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/服务器/" itemprop="url" rel="index">
                    <span itemprop="name">-服务器</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p>&emsp;&emsp;由于之前所接触的项目中，使用weblogic实在windowsserver上面操作，安装界面部署界面都是以图形化为主，最近的项目使用的weblogic则是在linux环境下的，所有重新了解下weblogic在linux下的使用。此处以weblogic12为例</p>
</blockquote>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><blockquote>
<p>&emsp;&emsp;其实在linux下面也是可以使用图形化安装界面的，但是,是不是觉得在Linux下面还用图形化界面，太low了。所有这里采用静默安装的方式，看着这一堆小黑窗口是不是感觉很高大上。</p>
</blockquote>
<ul>
<li>1.创建weblogic用户 配置jdk1.8环境变量</li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">#创建用户组</span><br><span class="line">[root@<span class="number">192</span> home]$ groupadd weblogic</span><br><span class="line">[root@<span class="number">192</span> home]$ useradd  -g weblogic weblogic</span><br><span class="line">[root@<span class="number">192</span> home]$ passwd weblogic </span><br><span class="line"># 切换用户到weblogic 配置环境变量</span><br><span class="line">[weblogic@<span class="number">192</span> home]$ cat  &lt;&lt; EOF &gt;&gt; ~/.bash_profile</span><br><span class="line">export JAVA_HOME=/home/weblogic/jdk/jdk1.<span class="number">8</span>.<span class="number">0</span>_201</span><br><span class="line">export JRE_HOME=\$JAVA_HOME/jre</span><br><span class="line">export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar:\$JRE_HOME/lib</span><br><span class="line">export <span class="built_in">PATH</span>=\$JAVA_HOME/bin:\$<span class="built_in">PATH</span></span><br><span class="line">EOF</span><br><span class="line"></span><br><span class="line">[weblogic@<span class="number">192</span> home]$source ~/.bash_profile</span><br></pre></td></tr></table></figure>

<p>*NOTE 提示权限不足需要给足权限</p>
<blockquote>
<p>chmod +x  /home/weblogic/jdk/jdk1.8.0_201/bin/javac<br>chmod +x  /home/weblogic/jdk/jdk1.8.0_201/bin/java </p>
</blockquote>
<ul>
<li>2.创建rsp响应文件</li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">[weblogic@<span class="number">192</span> home]$ touch wls.rsp</span><br><span class="line">[weblogic@<span class="number">192</span> home]$ cat &lt;&lt; EOF &gt;wls.rsp</span><br><span class="line">[ENGINE]</span><br><span class="line">Response File Version=<span class="number">1</span>.<span class="number">0</span>.<span class="number">0</span>.<span class="number">0</span>.<span class="number">0</span></span><br><span class="line">[GENERIC]</span><br><span class="line">#ORACLE_HOME weblogic位置 主要文件位置权限</span><br><span class="line">ORACLE_HOME=/home/weblogic/bea</span><br><span class="line">INSTALL_TYPE=WebLogic Server</span><br><span class="line">MYORACLESUPPORT_USERNAME=</span><br><span class="line">MYORACLESUPPORT_PASSWORD=&lt;SECURE VALUE&gt;</span><br><span class="line">DECLINE_SECURITY_UPDATES=true</span><br><span class="line">SECURITY_UPDATES_VIA_MYORACLESUPPORT=false</span><br><span class="line">PROXY_HOST=</span><br><span class="line">PROXY_PORT=</span><br><span class="line">PROXY_USER=</span><br><span class="line">PROXY_PWD=&lt;SECURE VALUE&gt;</span><br><span class="line">COLLECTOR_SUPPORTHUB_URL=</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>

<ul>
<li>3.创建loc文件 </li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="number">192</span> home]$ touch oraInst.loc</span><br><span class="line">[root@<span class="number">192</span> home]$ cat &lt;&lt; EOF &gt;&gt;oraInst.loc</span><br><span class="line">inventory_loc=/home/weblogic/oraInventory</span><br><span class="line"># 实际创建的用户组</span><br><span class="line">inst_group=weblogic</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>

<ul>
<li>执行静默安装</li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">#-silent表示采用静默安装</span><br><span class="line">#-ignoreSysPrereqs 忽略一些输出 可以不加</span><br><span class="line">[weblogic@<span class="number">192</span> home]$ java -jar /home/weblogic/fmw_12.<span class="number">2</span>.<span class="number">1</span>.<span class="number">4</span>.<span class="number">0</span>_wls_lite_generic.jar \</span><br><span class="line">-silent \</span><br><span class="line">-responseFile /home/weblogic/wls.rsp \</span><br><span class="line">-invPtrLoc /home/weblogic/oraInst.loc </span><br><span class="line">-ignoreSysPrereqs</span><br></pre></td></tr></table></figure>

<h2 id="域创建"><a href="#域创建" class="headerlink" title="域创建"></a>域创建</h2><ul>
<li>1.复制建域的脚本文件</li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">## 重置linux随机数来源 建域较快</span><br><span class="line">[weblogic@<span class="number">192</span> home]$ export CONFIG_JVM_ARGS='-Djava.security.egd=file:/dev/urandom'</span><br><span class="line">[weblogic@<span class="number">192</span> home]$ <span class="built_in">cd</span> /home/weblogic/bea/wlserver/common/templates/scripts/wlst</span><br><span class="line">[weblogic@<span class="number">192</span> wlst]$ cp basicWLSDomain.py mybasicWLSDomain.py</span><br></pre></td></tr></table></figure>

<ul>
<li>2.编辑模板文件</li>
</ul>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br></pre></td><td class="code"><pre><span class="line">#=======================================================================================</span><br><span class="line"># This is an example of a simple WLST offline configuration script. The script creates</span><br><span class="line"># a simple WebLogic domain using the Basic WebLogic Server Domain template. The script</span><br><span class="line"># demonstrates how to open a domain template, create and edit configuration objects,</span><br><span class="line"># and write the domain configuration information to the specified directory.</span><br><span class="line">#</span><br><span class="line"># This sample uses the demo Derby Server that is installed with your product.</span><br><span class="line"># Before starting the Administration Server, you should <span class="built_in">start</span> the demo Derby server</span><br><span class="line"># by issuing one of the following commands:</span><br><span class="line">#</span><br><span class="line"># Windows: WL_HOME\common\derby\bin\startNetworkServer.<span class="built_in">cmd</span></span><br><span class="line"># UNIX: WL_HOME/common/derby/bin/startNetworkServer.sh</span><br><span class="line">#</span><br><span class="line"># (WL_HOME refers to the top-level installation directory <span class="keyword">for</span> WebLogic Server.)</span><br><span class="line">#</span><br><span class="line"># The sample consists of a single server, representing a typical development environment.</span><br><span class="line"># This <span class="built_in">type</span> of configuration is <span class="keyword">not</span> recommended <span class="keyword">for</span> production environments.</span><br><span class="line">#</span><br><span class="line"># Please note that some of the values used <span class="keyword">in</span> this script are subject to change based on</span><br><span class="line"># your WebLogic installation and the template you are using.</span><br><span class="line">#</span><br><span class="line"># Usage:</span><br><span class="line">#      java weblogic.WLST &lt;WLST_script&gt;</span><br><span class="line">#</span><br><span class="line"># Where:</span><br><span class="line">#      &lt;WLST_script&gt; specifies the full <span class="built_in">path</span> to the WLST script.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Open a domain template.</span><br><span class="line">#=======================================================================================</span><br><span class="line">#默认就可以</span><br><span class="line">readTemplate("/home/weblogic/bea/wlserver/common/templates/wls/wls.jar")</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Configure the Administration Server and SSL port.</span><br><span class="line">#</span><br><span class="line"># To enable access by both local and remote processes, you should <span class="keyword">not</span> <span class="built_in">set</span> the</span><br><span class="line"># listen address <span class="keyword">for</span> the server instance (that is, it should be left blank or <span class="keyword">not</span> <span class="built_in">set</span>).</span><br><span class="line"># <span class="keyword">In</span> this case, the server instance will determine the address of the machine and</span><br><span class="line"># listen on it.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span>('Servers/AdminServer')</span><br><span class="line">#监听地址</span><br><span class="line"><span class="built_in">set</span>('ListenAddress','')</span><br><span class="line"> #端口</span><br><span class="line"><span class="built_in">set</span>('ListenPort', <span class="number">7001</span>)</span><br><span class="line"></span><br><span class="line">create('AdminServer','SSL')</span><br><span class="line"><span class="built_in">cd</span>('SSL/AdminServer')</span><br><span class="line"><span class="built_in">set</span>('Enabled', 'True')</span><br><span class="line"><span class="built_in">set</span>('ListenPort', <span class="number">7002</span>)</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Define the user password <span class="keyword">for</span> weblogic.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span>('/')</span><br><span class="line"><span class="built_in">cd</span>('Security/base_domain/User/weblogic')</span><br><span class="line"># Please <span class="built_in">set</span> password here before using this script, e.g. cmo.setPassword('value')</span><br><span class="line">#设置控制台登录密码</span><br><span class="line">cmo.setPassword('weblogic123')</span><br><span class="line">#=======================================================================================</span><br><span class="line"># Create a JMS Server.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/')</span><br><span class="line">#create('myJMSServer', 'JMSServer')</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Create a JMS System resource.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/')</span><br><span class="line">#create('myJmsSystemResource', 'JMSSystemResource')</span><br><span class="line">#<span class="built_in">cd</span>('JMSSystemResource/myJmsSystemResource/JmsResource/NO_NAME_0')</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Create a JMS Queue and its subdeployment.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#myq=create('myQueue','Queue')</span><br><span class="line">#myq.setJNDIName('jms/myqueue')</span><br><span class="line">#myq.setSubDeploymentName('myQueueSubDeployment')</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/')</span><br><span class="line">#<span class="built_in">cd</span>('JMSSystemResource/myJmsSystemResource')</span><br><span class="line">#create('myQueueSubDeployment', 'SubDeployment')</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Create and configure a JDBC Data Source, and sets the JDBC user.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/')</span><br><span class="line">#create('myDataSource', 'JDBCSystemResource')</span><br><span class="line">#<span class="built_in">cd</span>('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')</span><br><span class="line">#create('myJdbcDriverParams','JDBCDriverParams')</span><br><span class="line">#<span class="built_in">cd</span>('JDBCDriverParams/NO_NAME_0')</span><br><span class="line">#<span class="built_in">set</span>('DriverName','org.apache.derby.jdbc.ClientDriver')</span><br><span class="line">#<span class="built_in">set</span>('URL','jdbc:derby://localhost:<span class="number">1527</span>/db;create=true')</span><br><span class="line">#<span class="built_in">set</span>('PasswordEncrypted', 'PBPUBLIC')</span><br><span class="line">#<span class="built_in">set</span>('UseXADataSourceInterface', 'false')</span><br><span class="line">#create('myProps','Properties')</span><br><span class="line">#<span class="built_in">cd</span>('Properties/NO_NAME_0')</span><br><span class="line">#create('user', 'Property')</span><br><span class="line">#<span class="built_in">cd</span>('Property/user')</span><br><span class="line">#cmo.setValue('PBPUBLIC')</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')</span><br><span class="line">#create('myJdbcDataSourceParams','JDBCDataSourceParams')</span><br><span class="line">#<span class="built_in">cd</span>('JDBCDataSourceParams/NO_NAME_0')</span><br><span class="line">#<span class="built_in">set</span>('JNDIName', java.lang.String("myDataSource_jndi"))</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')</span><br><span class="line">#create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')</span><br><span class="line">#<span class="built_in">cd</span>('JDBCConnectionPoolParams/NO_NAME_0')</span><br><span class="line">#<span class="built_in">set</span>('TestTableName','SYSTABLES')</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Target resources to the servers.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">#<span class="built_in">cd</span>('/')</span><br><span class="line">#assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')</span><br><span class="line">#assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment', 'Target', 'myJMSServer')</span><br><span class="line">#assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># Write the domain and close the domain template.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line">setOption('OverwriteDomain', 'true')</span><br><span class="line"></span><br><span class="line">setOption('JavaHome', '/home/weblogic/jdk/jdk1.<span class="number">8</span>.<span class="number">0</span>_201')</span><br><span class="line">#新建域指定路径</span><br><span class="line">writeDomain('/home/weblogic/bea/wlserver/../user_projects/domains/basicWLSDomain')</span><br><span class="line">closeTemplate()</span><br><span class="line"></span><br><span class="line">#=======================================================================================</span><br><span class="line"># <span class="keyword">Exit</span> WLST.</span><br><span class="line">#=======================================================================================</span><br><span class="line"></span><br><span class="line"><span class="keyword">exit</span>()</span><br></pre></td></tr></table></figure>

<ul>
<li>3.通过模板创建域</li>
</ul>
<p>相关配置信息<a href="https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlstc/reference.html" target="_blank" rel="noopener">https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlstc/reference.html</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/home/weblogic/bea/wlserver/common/bin/wlst.sh /home/weblogic/bea/wlserver/common/templates/scripts/wlst/mybasicWLSDomain.py</span><br></pre></td></tr></table></figure>

<h2 id="weblogic免密后台启动"><a href="#weblogic免密后台启动" class="headerlink" title="weblogic免密后台启动"></a>weblogic免密后台启动</h2><p>&emsp;&emsp;weblogic生产模式启动时候会在控制台提示输入用户名密码，所有当我们在后台启动时 我们需要为其提供用户名密码的认证信息 ，在管理服务器域路径下，我们找到 域路径/servers/AdminServer/security/ 下面创建引导文件 ，boot.properties ,被管服务器只需将管理服务器的复制过去即可。<br>内容如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">#Wed Jul 15 09:44:19 CST 2020</span><br><span class="line">password=weblogic</span><br><span class="line">username=weblogic</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">#Wed Jul 15 09:44:19 CST 2020</span><br><span class="line">password=&#123;AES256&#125;M8r8F3clbzHlwaa2FiE0z9qlpw/8U3Km1Ak/CdZzpPI\=</span><br><span class="line">username=&#123;AES256&#125;LoWSJCP+eiK8fBw/M1kIC1t3/WAG2h0uCGBVP6RzolU\=</span><br></pre></td></tr></table></figure>

<p>该文件只需输入明文密码即可 ，在启动服务器后，weblogic会将明文加密 。之后即可使用后台启动服务 ，无需在控制台输入密码。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 启动管理服务器</span><br><span class="line">nohup ./startWeblogic.sh &gt; Adminserver.log 2&gt;&amp;1 &amp;</span><br><span class="line"># Server-1 启动的被管服务器 ip 管理服务器ip port 管理服务器端口</span><br><span class="line">nohup ./startManagedWebLogic.sh Server-1 t3://ip:port &gt; server-1.log 2&gt;&amp;1 &amp;</span><br></pre></td></tr></table></figure>

<h2 id="命令行部署"><a href="#命令行部署" class="headerlink" title="命令行部署"></a>命令行部署</h2><p>官方文档：<a href="https://docs.oracle.com/middleware/12212/wls/DEPGD/wldeployer.htm#DEPGD318" target="_blank" rel="noopener">https://docs.oracle.com/middleware/12212/wls/DEPGD/wldeployer.htm#DEPGD318</a></p>
<p>在Server-0,Server-1 上部署项目 多个被管服务器逗号分开不能有空格。<br>用户名密码可以使用配置文件和key这样密码就不会暴露在命令行[-userconfigfile config-file [-userkeyfile admin-key]]</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">java -cp /home/weblogic/bea/wlserver/server/lib/weblogic.jar weblogic.Deployer \</span><br><span class="line">-adminurl t3://192.168.118.131:7001 \</span><br><span class="line">-userconfigfile /home/weblogic/script/myuserconfigfile.secure -userkeyfile /home/weblogic/script/myuserkfile.secure \</span><br><span class="line">-targets Server-0,Server-1 \</span><br><span class="line">-name webapp \</span><br><span class="line">-deploy /home/weblogic/script/App/webapp.war \</span><br><span class="line">-appversion v1.0.0</span><br></pre></td></tr></table></figure>

<h2 id="使用weblogic脚本工具-wlst"><a href="#使用weblogic脚本工具-wlst" class="headerlink" title="使用weblogic脚本工具 wlst"></a>使用weblogic脚本工具 wlst</h2><p>官方文档:<a href="https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/wlstg/using_wlst.html" target="_blank" rel="noopener">https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/wlstg/using_wlst.html</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java -cp /home/weblogic/bea/wlserver/server/lib/weblogic.jar weblogic.WLST</span><br></pre></td></tr></table></figure>

<ul>
<li>生成连接的配置和key</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">wls:/offline&gt; connect(&apos;weblogic&apos;,&apos;weblogic123&apos;,&apos;t3://192.168.118.131:7001&apos;)</span><br><span class="line">Connecting to t3://192.168.118.131:7001 with userid weblogic ...</span><br><span class="line"></span><br><span class="line">wls:/basicWLSDomain/serverConfig/&gt; storeUserConfig(&apos;/home/weblogic/script/myuserconfigfile.secure&apos;,&apos;/home/weblogic/script/myuserkfile.secure&apos;)</span><br><span class="line">wls:/offline&gt; connect(userConfigFile=&apos;/home/weblogic/script/myuserconfigfile.secure&apos;,userKeyFile=&apos;/home/weblogic/script/myuserkfile.secure&apos;)</span><br><span class="line">wls:/basicWLSDomain/serverConfig/&gt; exit()</span><br></pre></td></tr></table></figure>


      
    </div>
    
    
    
+ <div style="text-align:center;color: #ccc;font-size:14px;">---------------- The End ----------------</div>
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/weblogic-oracle/" <i class="fa fa-tag"> -weblogic -oracle</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2020/06/19/2020-06-19-Oracle常用命令/" rel="next" title="Oracle常用命令">
                <i class="fa fa-chevron-left"></i> Oracle常用命令
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2020/08/05/2020-08-05-springMock的使用/" rel="prev" title="springMock的使用">
                springMock的使用 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">MR.zhang</p>
              <p class="site-description motion-element" itemprop="description">坚持是一种态度,每一分都值得</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">39</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">10</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">23</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装"><span class="nav-number">1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#域创建"><span class="nav-number">2.</span> <span class="nav-text">域创建</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#weblogic免密后台启动"><span class="nav-number">3.</span> <span class="nav-text">weblogic免密后台启动</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#命令行部署"><span class="nav-number">4.</span> <span class="nav-text">命令行部署</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用weblogic脚本工具-wlst"><span class="nav-number">5.</span> <span class="nav-text">使用weblogic脚本工具 wlst</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">MR.zhang</span>

  
</div>









        







        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

</body>
</html>
